import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'
import Login from '../views/Login.vue'
import EditPost from '../views/EditPost.vue'
import PostList from '../views/Postlist.vue'
import Test from '../views/test.vue'
import demo from '../views/demo.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'Home',
    component: Home,
    // 路由嵌套 
    children: [
      {
        path: 'postList',
        component: PostList
      },
      {
        path: '/editPost',
        component: EditPost
      },
    ]
  },
  {
    path: '/login',
    component: Login
  },
  {
    path: '/test',
    component: Test
  },
  {
    path: '/demo',
    component: demo
  },
]

const router = new VueRouter({
  routes
})

export default router
